<?php
require_once("./include/bm_config.php");
	
	if (!isset($_SESSION['administrator']) && !isset($_SESSION[$BM_ADMIN]))
	{
			echo "<script language='javascript'>\n";
			echo "alert('没有权限!');\n";
			echo " location.replace('".$BM_HOME."') ;\n";
			echo "</script>";
			mysql_free_result($result);
			exit(0);
	}
	$team_id = $_GET['tid'];
	$sql="SELECT * FROM `cr_team` WHERE `team_id`='$team_id' ";
	$result=mysql_query($sql);
	$rows_cnt=mysql_num_rows($result);
	if($rows_cnt == 0)
	{
			echo "<script language='javascript'>\n";
			echo "alert('没有这样一支队伍!');\n";
			echo "history.go(-1);\n";
			echo "</script>";
			mysql_free_result($result);
			exit(0);
	}
	mysql_free_result($result);
	$sql="DELETE FROM `cr_stu` WHERE `team_id`=$team_id";
	mysql_query($sql);// or die(mysql_error());
	$sql="DELETE FROM `cr_team` WHERE `team_id`=$team_id";
	mysql_query($sql);// or die(mysql_error());
	echo "<script language='javascript'>\n";
	echo "alert('删除成功!');\n";
	echo "history.go(-1);\n";
	echo "</script>";
?>